VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "PersonasTelefono"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Attribute VB_Ext_KEY = "SavedWithClassBuilder" ,"Yes"
Attribute VB_Ext_KEY = "Top_Level" ,"Yes"
Option Explicit


'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
''  PersonasTelefono.cls
''  Implementation of the table Class PersonasTelefono
''  Generated by Enterprise Architect
''  Created on:      15-Abr-2009 08:07:44 p.m.
''  Original author: Administrador
''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


Private rsPersonasTelefono As New ADODB.Recordset

Private m_pteCodigo As Integer
Private m_pteTelefono As String
Private m_pteTipoPersona As String
Private m_ptePersonaCodigo As Integer

Public Property Get pteCodigo() As Integer
    pteCodigo = m_pteCodigo
End Property
Public Property Let pteCodigo(ByVal inNew As Integer)
    If (m_pteCodigo = inNew) Then Exit Property
    m_pteCodigo = inNew
End Property

Public Property Get pteTelefono() As String
    pteTelefono = m_pteTelefono
End Property
Public Property Let pteTelefono(ByVal inNew As String)
    If (m_pteTelefono = inNew) Then Exit Property
    m_pteTelefono = inNew
End Property

Public Property Get pteTipoPersona() As String
    pteTipoPersona = m_pteTipoPersona
End Property
Public Property Let pteTipoPersona(ByVal inNew As String)
    If (m_pteTipoPersona = inNew) Then Exit Property
    m_pteTipoPersona = inNew
End Property

Public Property Get ptePersonaCodigo() As Integer
    ptePersonaCodigo = m_ptePersonaCodigo
End Property
Public Property Let ptePersonaCodigo(ByVal inNew As Integer)
    If (m_ptePersonaCodigo = inNew) Then Exit Property
    m_ptePersonaCodigo = inNew
End Property


'abre todos los telefonos de una persona en particular
Public Function abrirTelefonos() As Boolean
    If rsPersonasTelefono.State <> adStateClosed Then
        rsPersonasTelefono.Close
    End If
    rsPersonasTelefono.Open "select * from personasTelefono where pteTipoPersona = '" & m_pteTipoPersona _
    & "' and ptePersonaCodigo = " & m_ptePersonaCodigo, conexion.cn, adOpenDynamic, adLockOptimistic
    
    If rsPersonasTelefono.EOF And rsPersonasTelefono.BOF Then
        abrirTelefonos = False
    Else
        abrirTelefonos = True
        primerTelefono
    End If
End Function

Public Sub cargarTelefono()
    m_pteCodigo = rsPersonasTelefono.Fields("pteCodigo")
    m_pteTelefono = rsPersonasTelefono.Fields("pteTelefono")
End Sub

Public Sub cerrarTelefonos()
    If rsPersonasTelefono.State <> adStateClosed Then
        rsPersonasTelefono.Close
    End If
    rsPersonasTelefono.Close
End Sub

Public Function siguienteTelefono() As Boolean
    If Not rsPersonasTelefono.EOF Then
        rsPersonasTelefono.MoveNext
        If rsPersonasTelefono.EOF Then
            rsPersonasTelefono.MovePrevious
            siguienteTelefono = False
        Else
            siguienteTelefono = True
        End If
        cargarTelefono
    End If
End Function

Public Function anteriorTelefono() As Boolean
    If Not rsPersonasTelefono.BOF Then
        rsPersonasTelefono.MovePrevious
        If rsPersonasTelefono.BOF Then
            rsPersonasTelefono.MoveNext
            anteriorTelefono = False
        Else
            anteriorTelefono = True
        End If
        cargarTelefono
    End If
End Function

Public Sub primerTelefono()
    If Not rsPersonasTelefono.EOF And Not rsPersonasTelefono.BOF Then
        rsPersonasTelefono.MoveFirst
        cargarTelefono
    End If
End Sub

Public Sub ultimoTelefono()
    If Not rsPersonasTelefono.EOF And Not rsPersonasTelefono.BOF Then
        rsPersonasTelefono.MoveLast
        cargarTelefono
    End If
End Sub

